<?php

/**
 * 
 * @author 陈德本
 *
 */
class pagerController extends Controller {

    public $initphp_list = array();

    private $conf;

    public function __construct() {
        parent::__construct();
        $this->conf = InitPHP::getConfig();
        $this->view->assign("pro_cat", $this->getProduct()->getMenu());
        $this->view->assign("nav", $this->getNav()->getNav(tree,1));
        $this->view->assign("slide", $this->getSlide()->getAll());
        $this->view->assign("link", $this->getLink());
        $this->view->assign("category", $this->getCatgory()->getCatgory());
    }

    public function run() {
        $id = $this->controller->get_get('id');
        if (! $id)
            $id = 1;
        $data = $this->getPager()->getOne($id);
        if (! $data) {
            JsMessage("文章不存在！", "/");
            die();
        }
        $this->view->assign("title", $data['seo_title']);
        $this->view->assign("keywords", $data['keyword']);
        $this->view->assign("description", $data['descript']);
        $this->view->assign("data", $data);
        $this->view->set_tpl("home/pager/content");
        $this->view->display();
    }

    /**
     *
     * @return navService
     */
    private function getNav() {
        return InitPHP::getService("nav");
    }

    /**
     *
     * @return pagerService
     */
    private function getPager() {
        return InitPHP::getService("pager");
    }

    /**
     *
     * @return catgoryService
     */
    private function getCatgory() {
        return InitPHP::getService("catgory");
    }

    /**
     *
     * @return productService
     */
    private function getProduct() {
        return InitPHP::getService("product");
    }
    /**
     *
     * @return slideService
     */
    private function getSlide(){
        return InitPHP::getService("slide");
    }
    private function getLink(){
        return InitPHP::getDao("link")->getAll();
    }
}